package com.yckj.day02;

import java.util.Scanner;

/**
 * TODO Scanner从键盘输入
 * 任务3、从键盘上输入一个圆的半径，求其面积和周长
 *
 * @author shengyuee
 * @version 1.0
 * 2025/7/17 14:15
 */
public class ScannerDemo {
    public static void main(String[] args) {
        // 创建Scanner对象
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入圆的半径:");
        int r = scan.nextInt();
        double area = Math.PI * r * r;
        System.out.println("area = " + area);
        double p = 2 * Math.PI * r;
        System.out.println("p = " + p);
        scan.close();
    }
}
